{extend name="public:_base" /}

{block name="css"}
{CSS href="__STATIC__/w/layui.css" /}
{CSS href="__STATIC__/w/divtable.css" /}
{/block}

{block name="js"}
{include file="public/_validform"}
{js href='__STATIC__/w/layui.js' /}
{/block}

{block name="main"}

<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 基本设置
    <a class="btn radius btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<form class="form form-horizontal layui-form-cont" action="{:url('System/save')}" id="form" method="post">
    
    <div class="layui-form-title">
        请填写接口配置信息，此信息需要你拥有自己的服务器资源。填写的URL需要正确响应微信发送的Token验证
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* Token(令牌)</label>
        <div class="layui-input-block">
            <input type="text" name="Token" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="必须为英文或数字，长度为3-32字符。" value="{$data.Token.value ?? ''}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* appid</label>
        <div class="layui-input-block">
            <input type="text" name="appid" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入内容" value="{$data.appid.value ?? ''}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* appsecret</label>
        <div class="layui-input-block">
            <input type="text" name="appsecret" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入内容" value="{$data.appsecret.value ?? ''}">
        </div>
    </div>

    <!--
    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* EncodingAESKey</label>
        <div class="layui-input-block">
            <input type="text" name="EncodingAESKey" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="消息加密密钥由43位字符组成，可随机修改，字符范围为A-Z，a-z，0-9。" value="{$data.EncodingAESKey.value ?? ''}">
        </div>
    </div>

    <div class="layui-form-title">
        默认回复/关注回复：用户关注的公众号时的回复信息
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* 默认回复</label>
        <div class="layui-input-block">
            <textarea name="defaultEvent" class="layui-textarea" placeholder="说点什么...最少输入10个字符" >{$data.defaultEvent.value ?? ''}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="color: #f00;">* 关注回复</label>
        <div class="layui-input-block">
            <textarea name="Event" class="layui-textarea" placeholder="说点什么...最少输入10个字符" >{$data.Event.value ?? ''}</textarea>
        </div>
    </div>
    -->

    <div class="layui-form-item">
        <div class="layui-input-block">
            <input name="type" value="{$type}" type="hidden"/>
            <button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn radius layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script>
    layui.use('form', function(){
        var form = layui.form
        form.on('submit(SBT)', function(data){
            var load = layer.load();
            $.post('',data.field,function (res) {
                if(res.status=='0'){
                    layer.close(load);
                    layer.alert(res.msg);
                }
                if(res.status=='1'){
                    layer.close(load);
                    layer.msg(res.msg,{time:1000},function () {
                        window.location.href=res.url;
                    });
                }
            })
            return false;
        });
</script>
{/block}

